import {DataTypes} from "sequelize";
import {sequelize} from "../../config/mysqlDB.js";
// const {roleModel} = require("../role/roleModel");
const userModel = sequelize.define('user', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  username: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
  },
   password: {
     type: DataTypes.STRING,
     allowNull: false,
   },
  roleId: {
    type: DataTypes.INTEGER,
    allowNull: false,
  },
  testDate: {
    type: DataTypes.DATE,
    allowNull: false,
  },

}, {
  returning: true,
});

// userModel.belongsTo(roleModel, {as: 'role', foreignKey: 'roleId'});

export default userModel;